package core.models;
import java.io.Serializable;
/**
 * A wagon for use in Oregon Trail.
 *
 * Holds a group, pace, and the capacity of the wagon.
 *
 */
public class Wagon implements Serializable
{
    
    /**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private Paces pace;
    private int weightCapacity = 3500;
    private Inventory inventory;
    
    /**
     * Constructor method with group and pace.
     */
    public Wagon(){
    	inventory = new Inventory();
    	pace = Paces.MODERATE;
    }
    
    /**
     * Returns the wagon's inventory weight.
     *
     * @return weight of inventory
     */
    public int getWeight() {
    	return inventory.getTotalWeight();
    }
    
    /**
     * Gets the remaining weight.
     *
     * @return the remaining weight
     */
    public int getRemainingWeight() {
    	return weightCapacity - getWeight();
    }
    
    public int getWeightCapacity()
    {
    	return weightCapacity;
    }
    
    /**
     * Sets the inventory.
     *
     * @param inventory the new inventory
     */
    public void setInventory(Inventory inventory) {
    	this.inventory = inventory;
    }
    
    /**
     * Gets the inventory.
     *
     * @return the inventory
     */
    public Inventory getInventory(){
    	return inventory;
    }
    /**
     * Returns the current pace of the wagon.
     *
     * @return The current pace.
     */
    public Paces getPace()
    {
        return pace;
    }
    
    
    /**
     * Method allows Group to eat food and changes Group's inventory of food
     * 
     * @param ration Group's set ration 
     * @return a boolean whether or not there is food left
     */
    public boolean updateFood(int ration)
    {
    	return inventory.eatFood(ration  * ration * 2);
    }

    /**
     * Sets the pace of the wagon.
     *
     * @param pace The new pace for the wagon. 
     */
    public void setPace(Paces pace)
    {
        this.pace = pace;
    }
    
    /**
     * Returns wagon as a string with pace and capacity.
     *
     * @return A string containing the pace and capacity of the wagon.
     */
    public String toString()
    {
    	return "pace: " + pace + "\n" + "capacity: " + weightCapacity;
    }
    
}
